<?php
namespace app\controller;

use app\BaseController;
use app\model\ConfigContactModel;
use app\model\ConfigModel;
use app\model\SalesModel;
use think\facade\View;

/**
 * 中心概况
 */
class Center extends BaseController
{

    /**
     * 中心概况
     */
    public function index()
    {
        // deleted = 0 type =  center
        $where = [
            'deleted' => 0,
            'type' => 'center'
        ];
        $config = ConfigModel::where($where)->find();
        View::assign('config', $config);

        return View::fetch();
    }

    /**
     * 工作人员查询
     */
    public function staff($no = null)
    {

        // 保存 no
        View::assign('no', $no);

        // 如果传入了no
        if ($no) {
            $where = [
                'employee_id' => $no,
                'deleted' => 0,
                'state' => 1
            ];
            $sales = SalesModel::where($where)->find();
            View::assign('sales', $sales);
        }


        return View::fetch();
    }


    /**
     * 联系我们
     */
    public function contact()
    {


        $contact = ConfigContactModel::where('deleted', 0)->find();
        View::assign('contact', $contact);

        return View::fetch();
    }


}
